import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;

import java.io.*;

public class Test {
    public static void main(String[] args) {

        SimpleEmail email = new SimpleEmail();

        email.setSslSmtpPort("465");// qq邮件服务器端口号
        email.setHostName("smtp.qq.com");//固定，主机
        email.setAuthentication("1326322881@qq.com","jbfcyreswlyhjdad");
        email.setCharset("UTF-8");

        String path = "d:\\塞尔达.png";
        try {
            BufferedInputStream bi = new BufferedInputStream(new FileInputStream(new File(path)));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
//        for (int i = 0; i < ; i++) {
//
//        }


        // 从文件把所有qq邮箱读取出来，放到一个数据结构中
        // 每次从里面取一个发，循环
        try {
            email.addTo("slayer1326322881.com@outlook.com");
            email.setFrom("1326322881@qq.com");
            email.setSubject("要哥哥");// 标题
            email.setMsg("要哥哥圆滚滚");// 正文
            email.send();
        } catch (EmailException e) {
            e.printStackTrace();
        }
    }
}
